package file.managerv2;

import java.io.File;
import java.util.ArrayList;
import java.util.List;

public class Filetest {
	public List<String> findFile(String path,String dat){
		java.io.File f=new File(path);
		List<String> slist=new ArrayList();
		if(f.exists()){
			File[] flist=f.listFiles();
			for(int i=0;i<flist.length;i++){
				String name=flist[i].getAbsolutePath();
				if(flist[i].isFile()&&name.endsWith(dat)){
					flist[i].delete();
					slist.add(name);
				}
				if(flist[i].isDirectory()){
					
					List<String> slist2=new ArrayList();
					slist2=findFile(name,dat);
					slist.addAll(slist2);
				}
			}
		}
		return slist;
	}
	public void listFile(List<String> list){
		for(int i=0;i<list.size();i++){
			System.out.println(i+" "+list.get(i));
		}
	}
	public  static void main(String args[]){
		Filetest ft=new Filetest();
		ft.listFile(ft.findFile("F:\\",".class"));
	}
}
